# Overview

JACOB is built on windows machines using ANT, most commonly from inside of Eclipse. The main steps for getting a working Jacob build are:

1. Check out the source code or unpack the source zip file from sourceforge
2. Install the Development Environment
3. Configure the build by creating a compilation_tools.properties file.
4. Run Eclipse and load the project into eclipse
5. Open the build.xml file in Eclipse and run the default ant target

# Repository Organization

Unpack the source archive zip file or check the files out of CVS into d:\jacob or some other familiar place. Source Java and JNI files are located in seperate packages from the unit tests and the samples.

- docs: documentation
- jni: c++ code
- lib: libraries needed to compile unit tests
- release: a directory built by the ant script where jacob is constructed
- samples: sample programs
- src: Jacob Java source files
- unittest: JUnit 3.8.1 unit test programs. Run from the test target in build.xml
- vstudio: some out of date VC++ project files
- bulid.xml: the ant build script. It can be run from inside Eclipse

The Servlet examples that required j2ee libraries to compile have temporarily been removed.

# Development Environment

The simplest build environment includes MS Visual C++ 8.0 (Studio 2005), Eclipse 3.3 with the C/C++ module and JDK 1.5. In that situation, you would just create the compilation_tools.properties using the example build.xml as a template.

- Microsoft Visual C++ 8.0 and it's included library. (to C:\ProgramFiles in my case)
- Eclipse 3.4 or later from www.eclipse.org as the Java IDE.
- Eclipse 3.4 or later with the C/C++ plugin can be used for C coding in place of VC++ IDE.
- Java JDK 1.5 (1.15 was built using 1.5.0.16)

Release | C Version | Java Version | ANT Version | Eclipse Version Used | generated DLLs
up to 1.6 | VC 98 (6.0) | ? | MAKE | ? | 32 bit
1.7 | VC 98 (6.0) | 1.4 | 1.? | ? | 32 bit
1.8 | VC 98 (6.0) | 1.4 | 1.? | ? | 32 bit
1.9 | VC 98 (6.0) | 1.4 | 1.? | ? | 32 bit
1.10 | VC 98 (6.0) | 1.4 | 1.? | 3.?? | 32 bit
1.11 | VC 98 (6.0) & 2003 64bit libs | 1.4.? | 1.6.? | 3.2.1 | 32 and 64 bit
1.12 | VC 98 (6.0) & 2003 64bit libs | 1.4.2 | 1.6.5 | 3.2.2 | 32 and 64 bit
1.13 | VC 2005 | 1.4.2 | 1.7.0 | 3.3 | 32 and 64 bit
1.14 | VC 2005 | 1.5.0 | 1.7.0 | 3.3 | 32 and 64 bit
1.15 | VC 2005 | 1.5.0 | 1.7.0 | 3.4 | 32 and 64 bit

Microsoft Visual C++ 8.0 supports 64 bit builds. so no additional tools are required.

# Build Process

The build process is based on ANT. You can run ANT from inside of eclipse or from the command line. The ant process is driven off of a configuration file named `compilation_tools.properties` that describes the locations of the JDK and Microsoft C++ tools. The `build.xml` file in the root directory contains examples of the contents of this file.

There are two main ant targets.

- "default" executes the following steps when using the default target.
  - Build the Java code
  - Build the jni code
  - create the dll
  - create jar file
- "package" runs the above listed steps and then
  - builds the javadoc
  - builds a source zip
  - builds a binary zip with the javadoc

# Eclipse Java IDE

Eclipse users have to do some minor tweaks to their project if they want to use the integrated build process. This is because the unit tests are files located in the "unittest" directory while the project source files themselves are in "src" the root directory. By default, eclipse will add the entire project as source. This messes up the package naming. In addition, the build directory should be set to be the same place the ANT build puts the compiled java classes. A couple small tweaks to the build path fix these problems:

Open up the project properties and go to the "Java Build Path" properties panel.

- Remove the root of the project from the build path
- Add folders `samples`, `src` and `unittest` to the build path in the Source tab.
- Exclude *.txt from each of the newly added folders.
- Set the default build output directory to `jacob-project/release/java`

## Troubleshooting Build Problems

- Symptom: The jar is built but no dlls were compiled.

  Problem: compilation_tools.properties does not have the correct location for the Microsoft tools.

- Sympton: Can't find jni.h or can't find C++ compiler

  Problem: compilation_tools.properties configured incorrectly. Either paths are wrong or the separator is wrong. It requires two backslashes for a separator.

# Running Samples and Tests

Samples and JUnit test programs can be found in the source jar or in CVS. The programs can be run from a bat file or from inside the Eclipse IDE. The java library path variable must be set to include the directory the jacob.dll is in. The simplest way to do that is to add it as a command line option. The following assume that your jacob development area is located in c:\dev\jacob:

    	-Djava.library.path=c:/dev/jacob/release/x86
    	-Dcom.jacob.autogc=false
    	-Dcom.jacob.debug=false
    	-Xcheck:jni

JUnit test programs can be individually run from inside eclipse or en-masse via the `ant test` target. Last Modified 10/2008 1.15